<template>
  <van-sticky>
      <van-nav-bar title="分类" />
  </van-sticky>

  <div class="type">
      <div class="list">
          <div class="item" v-for="item in TypeList" :key="item.id">
              <router-link :to="{path: '/product', query: {typeid: item.id}}">
                  <div class="thumb">
                      <img :src="item.thumb_text" />
                  </div>

                  <div class="name">{{item.name}}</div>
              </router-link>
          </div>

          <van-back-top :bottom="'80'" />
      </div>
  </div>

  <Tabbar />
</template>

<script setup>
  const {proxy} = getCurrentInstance()

  const TypeList = ref([])

  onBeforeMount(() => GetTypeData())

  const GetTypeData = async () =>
  {
      var result = await proxy.$POST({url: '/type/index'})

      if(result.code == 0)
      {
          proxy.$fail(result.msg)
          return false
      }
      
      TypeList.value = result.data
  }


</script>

<style scoped>
  @import url('/assets/css/ProductType.css');
</style>